package com.imooc.mapping.course5.copier;

import com.imooc.mapping.course5.*;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
@Mapper
@DecoratedWith(MetadataDecorator.class)//装饰器
public interface MetadataCopier {

    @BeforeMapping
    default void beforePrint(TParentDataMetaData metadata){
        System.out.println("之前执行的方法..");
    }

    @AfterMapping
    default void afterPrint(TParentDataMetaData metaData, @MappingTarget ParentMetaData metadata){
        System.out.println("映射之后执行的方法..");
    }

    MetadataCopier INSTANCE = Mappers.getMapper(MetadataCopier.class);
    Metadata metadataCopier(TDataCenterMetadata metadata);
}
